package com.ccnf.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ccnf.core.bean.TokenParams;
import com.ccnf.model.entity.Authorization;
import com.ccnf.model.entity.SocialUser;
import com.ccnf.model.entity.UserApply;
import com.ccnf.model.enums.ApplyStatusEnum;
import com.ccnf.model.enums.RoleTypeEnum;
import com.ccnf.model.vo.ApplyVO;
import com.ccnf.model.vo.AuthUserVO;
import com.ccnf.model.vo.UserVO;

import java.util.List;

/**
 * <p>
 * 用户社交信息表 服务类
 * </p>
 *
 * @author developer
 * @since 2018-10-09
 */
public interface UserService extends IService<SocialUser> {

    /**
     * 录入用户信息，如果录入的用户openId已经存在，则直接返回用户ID，否则插入用户信息后返回
     * @param socialUser 插入的用户信息
     * @return 返回用户ID
     */
    Long saveSocialUser(Long expoId, SocialUser socialUser);

    /**
     * 创建授权信息
     * @param tokenParams 令牌参数
     * @param authorization 授权信息
     * @return
     */
    String createRoleAuth(TokenParams tokenParams, Authorization authorization);

    /**
     * 获取用户信息
     * @param tokenParams
     * @return
     */
    UserVO findUserInfo(TokenParams tokenParams);

    List<AuthUserVO> listAuth(TokenParams tokenParams);

    void relieveAuth(String authCode, TokenParams tokenParams);

    void validateRole(TokenParams tokenParams, RoleTypeEnum[] roleTypeEnums);

    void saveUserApply(UserApply apply, TokenParams tokenParams);

    ApplyVO findUserApplyInfo(TokenParams tokenParams);

    List<ApplyVO> listUserApply(ApplyStatusEnum applyStatus, TokenParams tokenParams);

    void handleUserApplyAudit(Long applyId, ApplyStatusEnum applyStatus);
}